package com.citicpub_cloud.restfull.dao;

import java.util.List;

import org.springframework.stereotype.Service;

import com.citicpub_cloud.restfull.dao.core.TbBookInfo;
import com.citicpub_cloud.restfull.dao.jdbc.AbstractJdbcDaoSupport;
import com.citicpub_cloud.restfull.dao.mapper.TbBookInfoMapper;

@Service
public class EbookDaoService extends AbstractJdbcDaoSupport {
	public TbBookInfo getBaseInfo(Long id) {
		TbBookInfo obj = null;
		try {
			String sql = "select img,book_name,fileurl,url_size from tb_book_info a "
					+ "left join tb_book_files b on b.bookid = a.id "
					+ "where a.id=" + id;
			
			List<TbBookInfo> list = jdbcTemplate.query(sql,new TbBookInfoMapper());
			if(list.size()>0){
				obj = list.get(0);
			}
		} catch (Exception e) {
			log.error("根据电子书id查找基本信息出错", e);
		}
		
		return obj;
	}
}
